# Running Sway on Void Linux (without SystemD)

elogind is the part of SystemD logind that can run as standalone. So we need it to run Sway without SystemD. To do that we need to build `wlroots` with `elogind` option. Then we can install and use Sway as normal from the current repo. There are other ways to achieve this without elogind [here](https://github.com/swaywm/sway/wiki/Running-Sway-without-systemd). But I tried with the elogind option and I was successful.

__UPDATE:__ I tried again on a fresh install. The `elogind` option is set by default on the repo version. So you can skip the xbps-src command below and continue. `wlroots` should install as a dependency of `sway` if you follow the later commands.

```
git clone git://github.com/void-linux/void-packages.git
cd void-packages
./xbps-src binary-bootstrap
./xbps-src pkg wlroots -o elogind
sudo xbps-install --repository=hostdir/binpkgs wlroots
```

Install things necessary and enable dbus also:

```
sudo xbps-install elogind sway dmenu rxvt-unicode sakura
sudo ln -s /etc/sv/dbus /var/services/
```

`rxvt-unicode` and `sakura` are optional. Sakura is [Wayland supported](https://wiki.voidlinux.org/Wayland#Terminal_emulators), so it is good to have it handy.

You may also want to install `swaylock` and `swayidle` if you need.

Let's create the config directory for Sway:
`mkdir -p ~/.config/sway/`

Now copy your i3config to `~/.config/sway/` or if you want to use the template config from Sway:
`cp /etc/sway/config ~/.config/sway/config`

Now edit `~/.config/sway/config` if necessary.

If you want to launch Sway directly after booting:

Run `nano ~/.bashrc` and add:
```
# If running from tty1, start sway
if [ "$(tty)" = "/dev/tty1" ]; then
	exec sway
fi
```

If it says that `XDG_RUNTIME_DIR` is not found, then this to fix it:
```
mkdir -p /tmp/swaytmp
export XDG_RUNTIME_DIR=/tmp/swaytmp
```

To kill the Sway session, $mod+Shift+e. $mod is the Super or Windows key by default if you didn't change it on config.

Ref:
- https://github.com/swaywm/sway/wiki/Running-Sway-without-systemd
- https://wiki.voidlinux.org/Sway